<script type="text/javascript">
{literal}	
	var calendarObjForForm = new DHTMLSuite.calendar({minuteDropDownInterval:10,numberOfRowsInHourDropDown:5,callbackFunctionOnDayClick:'getDateFromCalendar',isDragable:true,displayTimeBar:false}); 
	calendarObjForForm.setCallbackFunctionOnClose('myOtherFunction');
	
	function myOtherFunction()
	{
		
		
	}
	function pickDate(buttonObj,inputObject,myDate)
	{
		calendarObjForForm.setCalendarPositionByHTMLElement(inputObject,0,inputObject.offsetHeight+2);	// Position the calendar right below the form input
		calendarObjForForm.setInitialDateFromInput(inputObject,'dd.mm.yyyy');	// Specify that the calendar should set it's initial date from the value of the input field.
		calendarObjForForm.addHtmlElementReference(myDate,inputObject);	// Adding a reference to this element so that I can pick it up in the getDateFromCalendar below(myInput is a unique key)
		if(calendarObjForForm.isVisible()){
			calendarObjForForm.hide();
		}else{
			calendarObjForForm.resetViewDisplayedMonth();	// This line resets the view back to the inital display, i.e. it displays the inital month and not the month it displayed the last time it was open.
			calendarObjForForm.display();
		}		
	}	
	/* inputArray is an associative array with the properties
	year
	month
	day
	hour
	minute
	calendarRef - Reference to the DHTMLSuite.calendar object.
	*/
	function getDateFromCalendar(inputArray)
	{
		var references = calendarObjForForm.getHtmlElementReferences(); // Get back reference to form field.
		references.expires_date.value = inputArray.day  + '.' + inputArray.month + '.' + inputArray.year;
		calendarObjForForm.hide();	
		
	}
	{/literal}	
	</script>
<div class="wrap">

{if $specials_message != null}
	<div id="ajaxResponse1" class="ajaxResponse fade" style="display:block">{$specials_message}</div>
{else}
	<div id="ajaxResponse1" class="ajaxResponse"></div>
{/if}
<h2>Edit Special</h2>
<form name="editspecial" id="editspecial" method="post" action="?{$smarty.server.QUERY_STRING}">
	<input type="hidden" name="act" value="editspecial" />
	<input type="hidden" name="id" value="{$smarty.get.id}" />
	<table class="adminform" width="100%" cellspacing="2" cellpadding="5">
		<tr>
			<th scope="row" valign="top">
			<label for="product_id">{TranslateTag}B_LABEL_PRODUCT_NAME{/TranslateTag}:</label></th>
			<td>        
	  			<select name='product_id' id='product_id' class='postform' onchange="OnGetImage('?{$smarty.server.QUERY_STRING}',this,'showimage');">
	  				<option value='{$THESPECIAL->product_id}'>{$THESPECIAL->product_name}({$THESPECIAL->unit_cost}{$THESPECIAL->symbol_left})</option>
		  			{foreach name=products from=$PRODUCTS item=item}
							<option id='{$item->product_id}' value='{$item->product_id}'>	
						{$item->product_name}({$item->product_price}{$item->symbol_left})
					</option>
                    {/foreach}
				</select>
	  		</td>
		</tr>
        <tr>
			<th width="33%" scope="row" valign="top">
			<label for="specials_new_products_price">{TranslateTag}B_LABEL_PRODUCT{/TranslateTag}:</label></th>
			<td width="67%" id="showimage">
				<img src="{$THESPECIAL->product_thumbnail}" />
            </td>
		</tr>
		<tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			<label for="specials_new_products_price">{TranslateTag}B_LABEL_NEW_PRICE{/TranslateTag}:</label></th>
			<td width="67%">
			<input name="specials_new_products_price" id="specials_new_products_price" type="text" value="{$THESPECIAL->specials_new_products_price}" size="50" /></td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			<label for="expires_date">Expires Date:</label></th>
			<td width="67%">
                <input type="text" name="expires_date" value="{$THESPECIAL->expires_date}" id="expires_date" size="30" minLength="10" maxlength="10"/>
                 <input type="button" value="" class="dateofbirth" onclick="pickDate(this,document.getElementById('expires_date'),'expires_date');">
            </td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="middle">
			<label for="status">{TranslateTag}B_LABEL_DISPLAY{/TranslateTag}</label></th>
			<td width="67%">
					<input {if $THESPECIAL->status eq "1"}checked{/if} name="status" id="status" type="checkbox" value="1"/>
			</td>
		</tr>
	</table>
	<p class="submit" align = "right">
		<input type="image" name="submit" src="../view/admin/images/object_save.png" value="" />
	</p>
</form>

</div>
